package com.da.javatest.leetCode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenlida
 * @date 2018/12/17 17:39
 * @description
 */
public class Code728 {
    public static void main(String[] args) {
        new Code728().selfDividingNumbers(66, 708);
    }

    public List<Integer> selfDividingNumbers(int left, int right) {
        if (left > right) { return null; }
        List<Integer> result = new ArrayList<>();
        for (; left <= right; left++) {
            String leftStr = left + "";
            if (leftStr.contains("0")) { continue; }
            boolean flag = true;
            for (char c : leftStr.toCharArray()) {
                if (left % (c - 48) != 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                result.add(left);
            }
        }
        return result;
    }
}
